<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .header, .footer {
      width: 1200px;
      margin: 0 auto;
      background-color: skyblue;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 50px;
      height: 120px;
      color: #fff;
    }

    .footer {
      height: 300px;
    }

    ul, li {
      list-style: none;
    }

    ul {
      width: 1200px;
      display: flex;
      flex-wrap: wrap;
      margin: 0 auto;
      justify-content: space-between;
      padding-top: 10px;
    }

    li {
      width: 290px;
      border: 1px solid #333;
      margin-bottom: 10px;
      padding: 5px;
      box-sizing: border-box;
    }

    li > img {
      width: 278px;
      height: 300px;
      display: block;
    }

    .pagination {
      width: 1200px;
      margin: 10px auto;
      height: 50px;
      display: flex;
      align-items: center;
    }

    .pagination > .prev,
    .pagination > .next {
      width: 50px;
      height: 30px;
      cursor: pointer;
      background-color: orange;
      font-size: 24px;
      color: #fff;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .pagination > .disable {
      cursor: not-allowed;
      background-color: #ccc;
    }

    .pagination > .total {
      font-size: 30px;
      font-weight: 700;
      margin: 0 20px;
    }

    .pagination > select {
      font-size: 22px;
      padding-left: 20px;
      margin-left: 30px;
    }
  </style>
  <script src="./data.js"></script>
</head>
<body>

  <div class="header">网页头部</div>
  <div class="pagination">
    <span class="prev disable">&lt;</span>
    <span class="total">1 / 100</span>
    <span class="next">&gt;</span>
    <select>
      <option value="4">4</option>
      <option value="8">8</option>
      <option value="12">12</option>
      <option value="16">16</option>
    </select>
  </div>
  <ul>
    <!-- <li>
        <a href="https://item.taobao.com/item.htm?id=627543382638"><img src="https://img.alicdn.com/imgextra/i1/196993935/O1CN019g5Rmc1ewH9VOcioZ_!!196993935-0-picasso.jpg" alt="" width="278" height="278"></a>
        <p>优衣库 女装 棉质T恤(长袖) 430273 UNIQLO</p>
        <p>价格:79.00</p>
        <p>销量:0</p>
        <p>店名:优衣库官方旗舰店</p>
        <p>更新时间:2021-10-18 04:05:29</p>
      </li> -->

      <!-- 上面是一个li的示例 -->
      
  </ul>
  <div class="footer">网页底部</div>
  <script>
        // console.log(newarr);
        // alldata是总数据 
        //遍历数据的每一项 
        // 每次循环  拿到数组的每个元素  这个元素组装成一个li
        // 多个li 连在一起  
        // 最后放到ul中 
      var res_data = newarr.reduce(function(prev,item){
          return prev + `
          <li>
            <a href="${item['detail_url']}"><img src="${item['pic_url']}" alt="" width="278" height="278"></a>
            <p>${item['title']}</p>
            <p>价格:${item['price']}</p>
            <p>销量:${item['sales']}</p>
            <p>店名:${item['seller_nick']}</p>
            <p>更新时间:${item['data_update']}</p>
          </li>
          
          
          `
      },'');

      // console.log(res_data);

      document.querySelector('ul').innerHTML = res_data;
  </script>
</body>
</html>